home *** CD-ROM | disk | FTP | other *** search
- /*
- =======================================================================
-
- Plasma Gun version 1.0
- by Jonathan E. Wright
- <nelno@interpath.com>
- http://www.trailerpark.com/phase1/nelno/
-
- =======================================================================
- */
-
- /*
- ==================
- macros
- ==================
- */
-
- $frame nailatt1 nailatt2
-
- /*
- ==================
- prototypes
- ==================
- */
-
- void () SuperDamageSound;
- void (float damage) spawn_touchblood;
- void () player_run;
-
- /*
- ==================
- constants
- ==================
- */
-
- float IT_PLASMA = 16777216;
-
- /*
- ==================
- plasma_precache
- ==================
- */
-
- void () plasma_precache =
- {
- precache_sound ("plasma/plasma.wav");
- precache_sound ("plasma/plasexpl.wav");
- precache_model ("progs/s_plasma.spr");
- };
-
- void() plasma_impact1 = [1, plasma_impact2] {};
- void() plasma_impact2 = [2, plasma_impact3] {};
- void() plasma_impact3 = [3, plasma_impact4] {};
- void() plasma_impact4 = [4, plasma_impact5] {};
- void() plasma_impact5 = [1, plasma_impact6] {};
- void() plasma_impact6 = [5, SUB_Remove ] {};
-
-
- /*
- ==================
- plasma_touch
- ==================
- */
-
- void () plasma_touch =
- {
- local float rand;
- // hit something that bleeds
- if (other.takedamage)
- {
- // direct hit on an entity
- spawn_touchblood (2);
- // in Doom a single plasma bolt does 2 points of damage
- // but in Quake, it does 12 to achieve the same effect
- T_Damage (other, self, self.owner, 12);
- }
-
- sound (self, CHAN_WEAPON, "plasma/plasexpl.wav", 1, ATTN_NORM);
-
- self.nextthink = time + 0.1;
- self.think = plasma_impact1;
- self.touch = SUB_Null;
- self.velocity = '0 0 0';
- };
-
-
- /*
- ==================
- plasma_firebolt
- ==================
- */
-
- void () plasma_firebolt =
- {
- local vector dir;
- local entity old;
-
- makevectors (self.v_angle);
-
- if (self.ammo_cells < 1 && self.weapon == IT_PLASMA)
- {
- self.weapon = W_BestWeapon ();
- W_SetCurrentAmmo ();
- return;
- }
-
- self.attack_finished = time + 0.1;
- self.currentammo = self.ammo_cells = self.ammo_cells - 1;
- dir = aim (self, 1000);
-
- // dir = normalize ((self.origin + (v_forward * 1000)) - self.origin);
-
- // launch the energy ball
-
- sound (self, CHAN_WEAPON, "plasma/plasma.wav", 1, ATTN_NORM);
-
- newmis = spawn ();
- newmis.owner = self;
- newmis.movetype = MOVETYPE_FLYMISSILE;
- newmis.solid = SOLID_BBOX;
-
- newmis.touch = plasma_touch;
- newmis.classname = "plasma_bolt";
- newmis.think = SUB_Remove;
- newmis.nextthink = time + 3;
- setmodel (newmis, "progs/s_plasma.spr");
- setsize (newmis, '-0 -0 -0', '0 0 0');
- setorigin (newmis, self.origin + '0 0 0');
-
- newmis.frame = 0;
-
- // newmis.velocity = dir * 750;
- // add players velocity to shots
- newmis.velocity = (self.velocity * 0.5) + (dir * 750);
- newmis.angles = vectoangles (dir);
-
- newmis.v_angle = self.v_angle;
-
- self.punchangle_x = -2;
- self.attack_finished = time + 0.1;
- };
-
- /*
- ==================
- plasma_attack
- ==================
- */
-
- void () plasma_attack1 =[$nailatt1, plasma_attack2 ]
- {
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (!self.button0)
- {
- player_run ();
- return;
- }
-
- self.weaponframe = self.weaponframe + 1;
-
- if (self.weaponframe == 9) self.weaponframe = 1;
- SuperDamageSound();
-
- plasma_firebolt ();
- self.attack_finished = time + 0.1;
- };
-
- void() plasma_attack2 =[$nailatt2, plasma_attack1 ]
- {
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (!self.button0)
- {
- player_run ();
- return;
- }
-
- self.weaponframe = self.weaponframe + 1;
-
- if (self.weaponframe == 9) self.weaponframe = 1;
- SuperDamageSound();
-
- plasma_firebolt ();
- self.attack_finished = time + 0.1;
- };
-
- //============================================================================
-